//
//  CardLifeViewController.m
//  HuLaQuan
//
//  Created by hok on 1/16/16.
//  Copyright © 2016 Jianghao. All rights reserved.
//

#import "CardLifeViewController.h"

#import "CardLifeListCell.h"

@interface CardLifeViewController ()

@property (readwrite, nonatomic) NSMutableArray *cardLifeList; //of keys;

@property (strong, nonatomic) NSIndexPath *selectIndexPath;

@end

@implementation CardLifeViewController

static NSString * const CardLifeListCellIdentifier = @"CardLifeListCell";

- (NSMutableArray *)cardLifeList
{
    if (!_cardLifeList) {
        _cardLifeList = [[NSMutableArray alloc] init];
    }
    return _cardLifeList;
}

- (void)setupUI
{
    
    [self setupFooterForTableView];
    
    
    [self.tableView registerNib:[CardLifeListCell nib] forCellReuseIdentifier:CardLifeListCellIdentifier];
    
    self.title = @"卡生活";
    
    [self.cardLifeList addObject:@"hello"];
}


#pragma mark UITableViewDataSource


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return kCardLifeListCellHeight;
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.cardLifeList.count;
    
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    
    return kUserCenterSectionHeaderHeight;
    
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    
    CardLifeListCell *cell = [tableView dequeueReusableCellWithIdentifier:CardLifeListCellIdentifier
                                                            forIndexPath:indexPath];
    
    cell.titleLabel.text = self.cardLifeList[indexPath.row];
    return cell;
    
    
    
    
    
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
